import CommonApi from '@/api/CommonApi'
import request from '@/utils/request'

class FinVoucherMng extends CommonApi {
  getDetailData(mainId, replaceFlag, replaceDetailLotFlag) {
    return request({
      url: this.prefixurl + '/getDetailData',
      method: 'get',
      params: {
        mainId,
        replaceFlag,
        replaceDetailLotFlag
      }
    })
  }
  doUnsettle(data) {
    return request({
      url: this.prefixurl + '/doUnsettle',
      method: 'post',
      data
    })
  }
  doSettle(data) {
    return request({
      url: this.prefixurl + '/doSettle',
      method: 'post',
      data
    })
  }
  toAddFromFinTrx(data) {
    return request({
      url: this.prefixurl + '/toAddFromFinTrx',
      method: 'post',
      data
    })
  }
  doMonthSettle(finMonth) {
    const data = { 'finMonth': finMonth }
    return request({
      url: this.prefixurl + '/doMonthSettle',
      method: 'post',
      data
    })
  }
  doMonthUnsettle(finMonth) {
    const data = { 'finMonth': finMonth }
    return request({
      url: this.prefixurl + '/doMonthUnsettle',
      method: 'post',
      data
    })
  }
  getAccountBalanceInfo(finMonth) {
    return request({
      url: this.prefixurl + '/getAccountBalanceInfo',
      method: 'get',
      params: {
        finMonth
      }
    })
  }
  doVoucherSeriesNo(finMonth) {
    const data = { 'finMonth': finMonth }
    return request({
      url: this.prefixurl + '/doVoucherSeriesNo',
      method: 'post',
      data
    })
  }
  doLossSettleMonthProcess(finMonth) {
    const data = { 'finMonth': finMonth }
    return request({
      url: this.prefixurl + '/doLossSettleMonthProcess',
      method: 'post',
      data
    })
  }
}

export default new FinVoucherMng('fin-service/api/finVoucherMng')
